--DESCRIPTION, To Disable adhoc queries for each data provider.  

--IMPORTANT Be sure that you only apply the statement(s) below if they are specifically called for in the deployment documentation. 

--To undo the effect of the statements below, you can rerun the statement with a value of 0, or use regedit and set the value specified in the path to 0. If your application requires this you can add the functionality back on a per provider basis

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\Microsoft.Jet.Oledb.4.0',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\MSDAORA',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\ADSDSOObject',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\DB2OLEDB',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\MSIDXS',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\MSQLImpProv',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\MSSEARCHSQL',N'DisallowAdhocAccess',N'REG_DWORD',1
go

EXECUTE master.dbo.xp_regwrite N'HKEY_LOCAL_MACHINE',N'Software\Microsoft\MSSQLServer\Providers\MSDASQL',N'DisallowAdhocAccess',N'REG_DWORD',1
go

